// This programs creates displays lanes that appear to be moving
//Has its own main function for now

#include<stdlib.h>
#include<curses.h>

void drawLanesLV1(int laneSpeed, WINDOW *wnd);		//3 lanes
void drawLanesLV2(int laneSpeed, WINDOW *wnd);		//4 lanes
void drawLanesLV3(int laneSpeed, WINDOW *wnd);		//5 lanes
void drawLanesLV4(int laneSpeed, WINDOW *wnd);		//6 lanes
void drawLanesLV5(int laneSpeed, WINDOW *wnd);		//7 lanes
	//fast laneSpeed = 10
	//fastish laneSpeed = 110	
	//Medium  laneSpeed = 11000
	//Debug speed laneSpeed = 500000

int main(void)
{
        WINDOW *wnd;	//make new window

        initscr();        // start incurses      

	wnd =newwin(0,0,0,0);		//wnd now points to, new fullscreen window
	drawLanesLV5(2110, wnd);		//Call whatever leval you want with the speed and window pntr
					//We will make the default speeds fixed in the future and so we will only need to pass in the increas in speed
	endwin();
}

void drawLanesLV1(int laneSpeed, WINDOW *wnd)		//draws moving lanes, speed Depends on laneSpeed varible
{

	  int   maxcol,
                maxrow,
                row=0,
                col=0,
                rowTemp;

        getmaxyx(wnd, maxrow, maxcol);		//Gets the size of the window
	col = maxcol/4.0;		//set where the first colum starts
        while(TRUE)
        {
                if (row >= maxrow)	
                {
                        row = rowTemp;
                        rowTemp-= 2;
                        if (rowTemp >= maxrow)
                        {
                                rowTemp = 0;
                        }

                }

                mvprintw(row, col, "|\n \n");	//lane pattern
                mvprintw(row, col+8, "|\n \n");	//lane pattern
                mvprintw(row, col+16, "|\n \n");	//lane patternr
                mvprintw(row, col+24, "|\n \n");	//lane pattern
                row +=3;
                refresh();
		usleep(laneSpeed);		//lane speed
        }

}
void drawLanesLV2(int laneSpeed, WINDOW *wnd)           //draws moving lanes, speed Depends on laneSpeed varible
{

          int   maxcol,
                maxrow,
                row=0,
                col=0,
                rowTemp;

        getmaxyx(wnd, maxrow, maxcol);          //Gets the size of the window
	col = maxcol/4.0;		//set where the first colum starts
        while(TRUE)
        {
                if (row >= maxrow)
                {
                        row = rowTemp;
                        rowTemp-= 2;
                        if (rowTemp >= maxrow)
                        {
                                rowTemp = 0;
                        }

                }

                mvprintw(row, col, "|\n \n");   //lane pattern
                mvprintw(row, col+8, "|\n \n"); //lane pattern
                mvprintw(row, col+16, "|\n \n");        //lane patternr
                mvprintw(row, col+24, "|\n \n");        //lane patterns
                mvprintw(row, col+32, "|\n \n");        //lane pattern
                row +=3;
                refresh();
                usleep(laneSpeed);              //lane speed
        }

}
void drawLanesLV3(int laneSpeed, WINDOW *wnd)           //draws moving lanes, speed Depends on laneSpeed varible
{

          int   maxcol,
                maxrow,
                row=0,
                col=0,
                rowTemp;

        getmaxyx(wnd, maxrow, maxcol);          //Gets the size of the window
	col = maxcol/4.0;		//set where the first colum starts
        while(TRUE)
        {
                if (row >= maxrow)
                {
                        row = rowTemp;
                        rowTemp-= 2;
                        if (rowTemp >= maxrow)
                        {
                                rowTemp = 0;
                        }

                }

                mvprintw(row, col, "|\n \n");   //lane pattern
                mvprintw(row, col+8, "|\n \n"); //lane pattern
                mvprintw(row, col+16, "|\n \n");        //lane patternr
                mvprintw(row, col+24, "|\n \n");        //lane pattern
                mvprintw(row, col+32, "|\n \n");        //lane pattern
                mvprintw(row, col+40, "|\n \n");        //lane pattern
                row +=3;
                refresh();
                usleep(laneSpeed);              //lane speed
        }

}
void drawLanesLV4(int laneSpeed, WINDOW *wnd)           //draws moving lanes, speed Depends on laneSpeed varible
{

          int   maxcol,
                maxrow,
                row=0,
                col=0,
                rowTemp;

        getmaxyx(wnd, maxrow, maxcol);          //Gets the size of the window
	col = maxcol/4.0;		//set where the first colum starts
        while(TRUE)
        {
                if (row >= maxrow)
                {
                        row = rowTemp;
                        rowTemp-= 2;
                        if (rowTemp >= maxrow)
                        {
                                rowTemp = 0;
                        }

                }

                mvprintw(row, col, "|\n \n");   //lane pattern
                mvprintw(row, col+8, "|\n \n"); //lane pattern
                mvprintw(row, col+16, "|\n \n");        //lane patternr
                mvprintw(row, col+24, "|\n \n");        //lane pattern
                mvprintw(row, col+32, "|\n \n");        //lane pattern
                mvprintw(row, col+40, "|\n \n");        //lane pattern
                mvprintw(row, col+48, "|\n \n");        //lane pattern
                row +=3;
                refresh();
                usleep(laneSpeed);              //lane speed
        }

}
void drawLanesLV5(int laneSpeed, WINDOW *wnd)           //draws moving lanes, speed Depends on laneSpeed varible
{

          int   maxcol,
                maxrow,
                row=0,
                col=0,
                rowTemp;

        getmaxyx(wnd, maxrow, maxcol);          //Gets the size of the window
	col = maxcol/4.0;		//set where the first colum starts
        while(TRUE)
        {
                if (row >= maxrow)
                {
                        row = rowTemp;
                        rowTemp-= 2;
                        if (rowTemp >= maxrow)
                        {
                                rowTemp = 0;
                        }

                }

                mvprintw(row, col, "|\n \n");   //lane pattern
                mvprintw(row, col+8, "|\n \n"); //lane pattern
                mvprintw(row, col+16, "|\n \n");        //lane patternr
                mvprintw(row, col+24, "|\n \n");        //lane pattern
                mvprintw(row, col+32, "|\n \n");        //lane pattern
                mvprintw(row, col+40, "|\n \n");        //lane pattern
                mvprintw(row, col+48, "|\n \n");        //lane pattern
                mvprintw(row, col+56, "|\n \n");        //lane pattern
                row +=3;
                refresh();
                usleep(laneSpeed);              //lane speed
        }

}

